#include <QCoreApplication>
#include <QtWidgets>
//#include "butterfly.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QTime time = QTime::currentTime();
    qsrand(time.msec()+time.second()*1000);

//    QGraphicsScene *scene = new QGraphicsScene;
//    scene->setSceneRect(QRectF(-200,-200,400,400));
//    //scene->setBackgroundBrush(Qt::darkBlue);

//    for (int i = 0; i < 10; i++) {
//        Butterfly *butterfly = new Butterfly;
//        butterfly->setPos(-100 + i * 20, i * 20);
//        scene->addItem(butterfly);
//    }

//    QGraphicsRectItem *item = new QGraphicsRectItem(QRectF(0,0,60,60));
//    QPen pen;
//    pen.setWidth(3);
//    pen.setColor(QColor(qrand()%256,qrand()%256,qrand()%256));
//    item->setPen(pen);
//    item->setBrush(QColor(qrand()%256,qrand()%256,qrand()%256));
//    item->setFlag(QGraphicsItem::ItemIsMovable);
//    scene->addItem(item);
//    //item->setPos((qrand()%int(scene->sceneRect().width()))-200,(qrand()%int(scene->sceneRect().height()))-200);
//    item->setPos(-200, -200);

//    StarItem *star = new StarItem;
//    QGraphicsItemAnimation *anim = new QGraphicsItemAnimation;
//    anim->setItem(star);
//    QTimeLine *timeLine = new QTimeLine(4000);
//    timeLine->setCurveShape(QTimeLine::SineCurve);
//    timeLine->setLoopCount(0);
//    anim->setTimeLine(timeLine);

//    int y = (qrand()%400) - 200;
//    for (int i=0; i<400; i++)
//    {
//        anim->setPosAt(i/400.0, QPointF(i-200,y));
//    }
//    timeLine->start();
//    scene->addItem(star);

//    QGraphicsView *view = new QGraphicsView;
//    view->setScene(scene);
//    view->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
//    view->setDragMode(QGraphicsView::ScrollHandDrag);

//    view->resize(450, 450);
//    //view->setMinimumSize(400,400);

//    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//    //view->setFixedSize(402, 402);
//    view->show();

    QGraphicsScene scene;
    scene.addText("Hello, world!");

    QGraphicsView view(&scene);
    view.show();

    return a.exec();
}
